package net.starwifi.duobao.service.impl;

import net.sf.ehcache.CacheManager;
import net.starwifi.duobao.SettingUtils;
import net.starwifi.duobao.service.WoService;
import net.starwifi.duobao.utils.WoUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * Created by Administrator on 2015/11/26.
 */
@Service
public class WoServiceImpl implements WoService {


    @Resource(name = "ehCacheManager")
    private CacheManager cacheManager;


    @Override
    public String findNum(String uuid) {
        return WoUtils.getPhoneNum(getToken(),uuid);
    }

    private String getToken(){
      /*  Ehcache cache = cacheManager.getEhcache("WO_CACHE");
        Element element = cache.get("token");
        String token=null;
        if (element != null) {
            token = (String) element.getObjectValue();
        } else {
            token= WoUtils.getToken();
            cache.put(new Element("token", token));
        }
        return token;*/
        return SettingUtils.get("woToken");
    }

}
